package com.leancloud.circle.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.leancloud.circle.R;
import com.leancloud.circle.bean.FansBean;

import tech.com.commoncore.manager.GlideManager;

public class FansAdapter extends BaseQuickAdapter<FansBean, BaseViewHolder> {

    public FansAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(final BaseViewHolder helper, final FansBean item) {
        ImageView headIcon = helper.itemView.findViewById(R.id.fans_item_head_img);
        TextView attentionTx = helper.itemView.findViewById(R.id.fans_item_attention_tx);

        GlideManager.loadCircleImg(item.avatar, headIcon);

        helper.setText(R.id.fans_item_nike_tx, item.user_nickname);

        attentionTx.setSelected(true);
        attentionTx.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                CurrentUser user = UserGlobal.getCurrentUser();
//                CircleGlobal.getCircleImp().attentionAddOrRemove(user.getToken(), String.valueOf(item.id), new CircleBack() {
//                    @Override
//                    public void onBack(Object o, String err) {
//                        if (err == null) {
//                            remove(helper.getLayoutPosition());
//                        } else {
//                            ToastUtil.show("操作失败,请检查网络");
//                        }
//                    }
//                });
            }
        });
    }
}
